{set:$seller_id = $this->seller['seller_id'];$searchArray = Util::getUrlParam('search')}
{set:$searchParam = http_build_query($searchArray)}
{set:$where = Util::search(IReq::get('search'));$join = isset($searchArray['search']['ce.category_id=']) ? " left join category_extend as ce on ce.goods_id = go.id " : ""}
<h1 class="page_title">共享商品列表</h1>
<section class="share_list">
	<form action="{url:/seller/goods_copy}" method="post" name="goodsForm">
		<ul>
			{set:$page = IReq::get('page') ? IFilter::act(IReq::get('page'),'int') : 1}
			{query:name=goods as go where=go.is_share eq 1 and go.is_del eq 0 and go.seller_id eq 0 and $where page=$page join=$join id=$goodsObject fields=distinct go.id, go.*  key=$dataKey}
			<li>
				<div class="goods">
					<img src='{url:/pic/thumb/img/$item[img]/w/200/h/200}'>
					<strong class="name">{$item['name']}</strong>
					<span class="type">
						{set:$catName = array()}
						{query:name=category_extend as ce join=left join category as cd on cd.id eq ce.category_id fields=cd.name where=goods_id eq $item[id] item=$catData}
							{set:$catName[] = $catData['name']}
						{/query}
						{echo:join(',',$catName)}
					</span>
					<em class="price">销售价：￥{$item['sell_price']}</em>
					<span class="store">库存：{$item['store_nums']}</span>
					<button onclick="copyGoods({$item['id']})" type="button">复制商品</button>
				</div>
			</li>
			{/query}
		</ul>
	</form>
	{if:!isset($dataKey)}
		<div class="nothing">暂时没有数据</div>
	{/if}
</section>
{$goodsObject->getPageBar()}

<script>
//商品详情的跳转连接
function copyGoods(idVal)
{
	if(!idVal)
	{
		var idString = [];
		$('input:checkbox[name="id[]"]:checked').each(function(i)
		{
			idString.push(this.value);
		});
		idVal = idString.join(',');
	}

	if(idVal)
	{
		$.get("{url:/seller/goods_copy}",{"id":idVal},function(content)
		{
			if(content == 'success')
			{
				window.location.href = "{url:/seller/goods_list}";
			}
			else
			{
				alert(content);
			}
		});
	}
	else
	{
		alert("请选择您要操作的商品");
	}
}
</script>
